package com.fancy.common.utils.lbs;

import com.fancy.common.constant.LBSConstants;

/**
 * 计数器--控制当前BUMP阻塞的线程数
 * 
 * @author xinfeng.hu 2013-3-13下午12:15:34
 * @version 1.0.0
 * @category 杭州广桥网络技术有限公司(商业先知)
 */
public class LBSCounter {

	private static int value = 0;

	public static synchronized int getValue() {
		return value;
	}

	public static boolean allow() {
		return getValue() < LBSConstants.BUMP_THREAD_MAX_SIZE;
	}

	public static synchronized int increment() {
		return ++value;
	}

	public static synchronized int decrement() {
		return --value;
	}

}
